package com.woniuxy.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAspect2 {
    @Pointcut("execution(* com.woniuxy.service.impl.*.*(..))")
    private void qierudian(){}

    @Before("qierudian()")
    public void beforeAdvice(JoinPoint joinPoint){
        System.out.println(joinPoint.getTarget()+"..."+joinPoint.getSignature().getName());
    }
    @AfterReturning("qierudian()")
    public void afterReturnningAdvice(JoinPoint joinPoint){
        System.out.println(joinPoint.getTarget()+"..."+joinPoint.getSignature());
    }
    @AfterThrowing(pointcut = "qierudian()",throwing = "ex")
    public void throwingAdvice(JoinPoint joinPoint,Throwable ex){
        System.out.println(joinPoint.getTarget()+"..."+joinPoint.getSignature().getName());
    }
    @After("qierudian()")
    public void afterAdvice() {
        System.out.println("最后我来");
    }
}
